﻿/*********************************************************************************************************************
Unit tests VanguardDocumentation, View Level0Entities

© 2014 Erik Ackerholm

This file is part of SqlVanguard.

SqlVanguard is free software: you can redistribute it and/or modify it under the terms of the GNU General Public 
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later 
version.

SqlVanguard is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with SqlVanguard. If not, see 
<http://www.gnu.org/licenses/>.
*********************************************************************************************************************/

set nocount on;
set xact_abort off;
GO

-- Basic test
declare @ExpectedResult as table (
	SearchOrder       integer not null,
	Level0Type        varchar(64) not null,
	Level0Name        nvarchar(128) not null
);

insert into @ExpectedResult
values
	(1, 'SCHEMA', 'TestSchema'),
	(2, 'USER', 'TestUser'),
	(5, 'FILEGROUP', 'TESTFILES');

if
	exists (
		select * from VanguardDocumentation.Level0Entities where Level0Name like 'Test%'
		except
		select * from @ExpectedResult
	)
begin
	raiserror ('Too many results in test', 16, 1);
end
if
	exists (
		select * from @ExpectedResult
		except
		select * from VanguardDocumentation.Level0Entities where Level0Name like 'Test%'
	)
begin
	raiserror ('Too few results in test', 16, 2);
end;
GO




